<?php
defined('ROOT') or die('No direct script access.');
echo "<!DOCTYPE html> <html>";
include ("config.php");
include_once $config["APPPATH"] . "/views/header.php";
include_once $config["APPPATH"] . "/views/menu.php";
$baseurl = $config['BASEPATH'];
?>
<body>
<script language="JavaScript">
    function del_confirm(prmid) {
        if (confirm("Удалить?"))
            window.location.replace('<?php echo $baseurl; ?>/{TemplateControllerPath}/del/id/' + prmid);
    }
</script>

<table class="table table-bordered">
	<thead>
		<tr>
			<th>Наименование</th>
			<th>Действия</th>
		</tr>
		<tr>
			<td colspan="2"><a href="<?php echo $baseurl; ?>/{TemplateControllerPath}/add"><img src="<?php echo $baseurl; ?>/img/add.png"></a></td>
		</tr>
	</thead>
	<tbody>
		<?php
		foreach ($rows as $row)
		{
			echo "<tr>";
			echo "<td><a href='$baseurl/{TemplateControllerPath}/edit/id/{$row->id}'>$row->title</a></td>";
			echo "<td><a href='$baseurl/{TemplateControllerPath}/edit/id/{$row->id}'><img src='$baseurl/img/edit.png'></a>
			          <a href='#' onClick='del_confirm({$row->id}); return false;'><img src='$baseurl/img/del.png'></a>
			</td>";
			echo "</tr>";
		}
		?>
	</tbody>
</table>
</body>